var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var a = (function () {
    function t() {
        this.distance = null;
        this.moveTime = null;
        this.callBack = null;
        this.checkPos = cc.Vec2.ZERO;
        this.ct = 0;
        this.startMove = !1;
    }
    t.prototype.moveBasePos = function () {
        return this.checkPos;
    };
    t.prototype.setBasePos = function (t) {
        this.checkPos = t;
    };
    t.prototype.moveToPos = function (t, e, o, a) {
        void 0 === a && (a = !1);
        var i = t,
            n = this.moveBasePos(),
            r = i.sub(n),
            s = r.mag() / e;
        this.moveTo(r, s, o);
    };
    t.prototype.moveTo = function (t, e, o) {
        this.distance = t;
        this.moveTime = e;
        this.callBack = o;
        this.ct = 0;
        this.startMove = !0;
    };
    t.prototype.stopMove = function () {
        this.startMove = !1;
    };
    t.prototype.isMove = function () {
        return this.startMove;
    };
    t.prototype.updateMove = function (t) {
        if (this.startMove)
            if (this.ct >= this.moveTime) {
                this.stopMove();
                this.callBack && this.callBack();
            } else {
                var e = t / this.moveTime,
                    o = cc.v2(this.distance.x * e, this.distance.y * e),
                    a = this.moveBasePos().add(o);
                this.checkPos.x = a.x;
                this.checkPos.y = a.y;
                this.ct += t;
            }
    };
    t.prototype.update = function (t) {
        this.updateMove(t);
    };
    return t;
})();
o.default = a;
